﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hydra.Shell.Attributes;
using Hydra.UrlMon.Enumerations;
using Hydra.UrlMon.Implementation;

namespace Hydra.UrlMon.Interfaces
{
    [Guid("82D904B9-35B8-45D5-8F0B-A78ABE71BF55")]
    public interface IInternetProtocol : IInternetProtocolRoot
    {

        /// <summary>Reads data retrieved by the pluggable protocol handler. </summary>
        /// <remarks>Developers who are implementing an asynchronous pluggable protocol must be prepared to have their implementation of IInternetProtocol::Read continue to be called a few extra times after it has returned S_FALSE. </remarks>
        /// <param name="pv">
        /// Address of the buffer where the information will be stored.</param>
        /// <param name="cb">
        /// Value that indicates the size of the buffer.</param>
        /// <param name="pcbRead">
        /// Address of a value that indicates the amount of data stored in the buffer.</param>
        
        int Read(IntPtr pv, int cb, out int pcbRead);

        /// <summary>Moves the current seek offset.</summary>
        /// <param name="dlibMove">
        /// Large integer value that indicates how far to move the offset.</param>
        /// <param name="dwOrigin">
        /// DWORD value that indicates where the move should begin.
        /// FILE_BEGIN : Starting point is zero or the beginning of the file. If FILE_BEGIN is specified, dlibMove is interpreted as an unsigned location for the new file pointer.
        /// FILE_CURRENT : Current value of the file pointer is the starting point.
        /// FILE_END : Current end-of-file position is the starting point. This method fails if the content length is unknown.</param>
        /// <param name="plibNewPosition">
        /// Address of an unsigned long integer value that indicates the new offset.</param>
        void Seek(long dlibMove, int dwOrigin, out long plibNewPosition);

        /// <summary>Locks the requested resource so that the IInternetProtocolRoot::Terminate method can be called and the remaining data can be read. </summary>
        /// <remarks>For asynchronous pluggable protocols that do not need to lock a request, the method should return S_OK.</remarks>
        /// <param name="dwOptions">
        /// Reserved. Must be set to 0.</param>
        void LockRequest(int dwOptions);

        /// <summary>Frees any resources associated with a lock. </summary>
        /// <remarks>This method is called only if IInternetProtocol::LockRequest was called. </remarks>
        void UnlockRequest();
    }
}
